package com.cloud.springbootcloud.service.impl;

import com.cloud.springbootcloud.pojo.Product;
import com.cloud.springbootcloud.service.ProductService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ProductServiceImpl implements ProductService {
    public List<Product> selectProductList() {
        return Arrays.asList(
                new Product(1,"华为手机",2,5888D),
                new Product(2,"联想笔记本",1,6888D),
                new Product(3,"小米平板",5,2666D)
        );
    }
    public Product selectProductById(Integer id) {

        return new Product(id,"冰箱",20,6000D);
    }

    public Product queryProductById(Integer id) {

        return new Product(id,"冰箱",10,5556D);
    }

    public Map<Object, Object> createProduct(Product product) {
        return new HashMap<Object, Object>(){
            {
                put("status",200);
                put("message","新增成功！");
            }
        };
    }
}
